package com.mvetc.service.impl;

import java.util.Map;

import com.mvetc.dao.UserDao;
import com.mvetc.dao.impl.UserDaoImpl;
import com.mvetc.entity.PageInfo;
import com.mvetc.entity.User;
import com.mvetc.service.UserService;

public class UserServiceImpl implements UserService {
private UserDao userDao=new UserDaoImpl(); 
	

	@Override
	public int register(User user) {
		
		return userDao.insert(user);
	}

	@Override
	public boolean existsOfAccountName(String userName) {

		User findByAccountName = userDao.findByUserName(userName);
		
		return findByAccountName != null ? true : false;
	}

	@Override
	public User login(String userName, String userPassword) {
		
		return userDao.findByUserNameAndPassword(userName, userPassword);
	}
	
	@Override
	public PageInfo<User> getBy(Map<String, String> params) {
		// TODO Auto-generated method stub
		return userDao.findBy(params);
	}

	@Override
	public int addUser(User user) {
		// TODO Auto-generated method stub
		return userDao.insert(user);
	}

	@Override
	public int deleteById(String userId) {
		// TODO Auto-generated method stub
		return userDao.deleteById(userId);
	}

	@Override
	public int modify(User user) {
		// TODO Auto-generated method stub
		return userDao.updateUser(user);
	}
}
